<template>
	<view class="knowledgePoints">
		<u-navbar title="知识点" :autoBack="true" :placeholder="true">
		</u-navbar>


		<view v-if="pointList.length>0" class="fileList">
			<view class="fileItme" v-for="(item,index) in pointList" :key="index">
				<image
					:src="role==1 ?'https://mp.blrwworkshop.com/imgs/dataNull.png' :'https://mp.blrwworkshop.com/imgs/dataNulls.png'"
					mode="">
				</image>
				<view class="fileName">
					{{item.name}}
				</view>
				<view class="lookBtn" :class="role==1?'bg_student':'bg_parent'" @click="handleDetail(item,index)">
					查看
				</view>
			</view>
		</view>


		<view v-else class="dataNull">
			<image src="https://mp.blrwworkshop.com/imgs/dataNull.png" mode=""></image>
			<view class="">
				暂无知识点内容~
			</view>
		</view>


	</view>
</template>

<script>
	import {
		qryKnowledgePointByChapter
	} from "@/api/course.js"
	export default {
		data() {
			return {
				role: uni.getStorageSync('role'),
				chapterId: "",
				PointpageNum: 1,
				pointList: [],
			}
		},
		onLoad(options) {
			this.chapterId = options.chapterId
			console.log("chapterId", this.chapterId)
			this.handleqryKnowledgePointByChapter()
		},
		methods: {
			//知识点
			async handleqryKnowledgePointByChapter() {
				let res = await qryKnowledgePointByChapter({
					chapterId: this.chapterId,
					pageSize: 10,
					pageNum: this.PointpageNum

				})
				this.pointList = [...this.pointList, ...res.rows]
			},
			handleDetail(item, index) {
				uni.navigateTo({
					url: `/pages/coursePackage/knowledgePointsDetail/knowledgePointsDetail?id=${item.id}&downUrl=${item.address}`
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	.knowledgePoints {
		width: 100%;
		min-height: 100vh;
		background-color: #F9F9F9;

		.fileList {
			width: 100%;
			margin-top: 1rpx;


			.fileItme {
				width: 100%;
				display: flex;
				align-items: center;
				height: 120rpx;
				background-color: #ffffff;
				padding: 24rpx 32rpx;
				box-sizing: border-box;
				margin-bottom: 1rpx;

				.checkBox {
					image {
						width: 36rpx;
						height: 36rpx;
						margin-right: 20rpx;
					}
				}

				image {
					width: 72rpx;
					height: 72rpx;
				}

				.fileName {
					font-weight: 400;
					font-size: 28rpx;
					color: #333333;
					line-height: 40rpx;
					width: 420rpx;
					white-space: nowrap;
					overflow: hidden;
					text-overflow: ellipsis;
					margin-left: 8rpx;
				}

				.lookBtn {
					width: 100rpx;
					height: 48rpx;
					// background: #FFA116;
					border-radius: 8rpx;
					font-weight: 400;
					font-size: 24rpx;
					color: #FFFFFF;
					line-height: 48rpx;
					text-align: center;
					margin-left: 86rpx;
				}
			}
		}

		.dataNull {
			width: 100%;
			display: flex;
			flex-direction: column;
			align-items: center;
			margin-top: 200rpx;
			font-weight: 400;
			font-size: 28rpx;
			color: #DDDDDD;
			margin-top: 20rpx;

			image {
				width: 330rpx;
				height: 330rpx;

			}
		}

	}
</style>